home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / NameRegistry.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  15.1 KB  |  561 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        NameRegistry.a
  3. ;
  4. ;    Contains:    NameRegistry Interfaces
  5. ;
  6. ;    Version:    Technology:    MacOS
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__NAMEREGISTRY__') = 'UNDEFINED' THEN
  18. __NAMEREGISTRY__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.  
  24. ; *******************************************************************************
  25. ; * 
  26. ; * Foundation Types
  27. ; *
  28.  
  29. ;  Value of a property 
  30. ; typedef void *                        RegPropertyValue
  31.  
  32. ;  Length of property value 
  33. ; typedef UInt32                         RegPropertyValueSize
  34.  
  35. ; *******************************************************************************
  36. ; * 
  37. ; * RegEntryID    :    The Global x-Namespace Entry Identifier
  38. ; *
  39.  
  40. RegEntryID                RECORD 0
  41. contents                 ds.l    4                ; offset: $0 (0)
  42. sizeof                     EQU *                    ; size:   $10 (16)
  43.                         ENDR
  44. ; typedef struct RegEntryID *            RegEntryIDPtr
  45.  
  46. ; *******************************************************************************
  47. ; *
  48. ; * Root Entry Name Definitions    (Applies to all Names in the RootNameSpace)
  49. ; *
  50. ; *    • Names are a colon-separated list of name components.  Name components
  51. ; *      may not themselves contain colons.  
  52. ; *    • Names are presented as null-terminated ASCII character strings.
  53. ; *    • Names follow similar parsing rules to Apple file system absolute
  54. ; *      and relative paths.  However the '::' parent directory syntax is
  55. ; *      not currently supported.
  56.  
  57. ;  Max length of Entry Name 
  58.  
  59. kRegCStrMaxEntryNameLength        EQU        47
  60. ;  Entry Names are single byte ASCII 
  61. ; typedef char                             RegCStrEntryName
  62.  
  63. ; typedef char *                        RegCStrEntryNamePtr
  64.  
  65. ;  length of RegCStrEntryNameBuf =  kRegCStrMaxEntryNameLength+1
  66. RegCStrEntryNameBuf        RECORD 0
  67. elements                 ds.b    48
  68. sizeof                     EQU *                    ; size:   $30 (48)
  69.                         ENDR
  70.  
  71.  
  72. ; typedef char                             RegCStrPathName
  73.  
  74. ; typedef UInt32                         RegPathNameSize
  75.  
  76.  
  77. kRegPathNameSeparator            EQU        58                    ; 0x3A 
  78. kRegEntryNameTerminator            EQU        $00                    ; '\0' 
  79. kRegPathNameTerminator            EQU        $00                    ; '\0' 
  80. ; *******************************************************************************
  81. ; *
  82. ; * Property Name and ID Definitions
  83. ; *    (Applies to all Properties Regardless of NameSpace)
  84.  
  85.  
  86. kRegMaximumPropertyNameLength    EQU        31                    ; Max length of Property Name 
  87. kRegPropertyNameTerminator        EQU        $00                    ; '\0' 
  88. RegPropertyNameBuf        RECORD 0
  89. elements                 ds.b    32
  90. sizeof                     EQU *                    ; size:   $20 (32)
  91.                         ENDR
  92.  
  93.  
  94. ; typedef char                             RegPropertyName
  95.  
  96. ; typedef char *                        RegPropertyNamePtr
  97.  
  98. ; *******************************************************************************
  99. ; *
  100. ; * Iteration Operations
  101. ; *
  102. ; *    These specify direction when traversing the name relationships
  103.  
  104. ; typedef UInt32                         RegIterationOp
  105.  
  106. ; typedef RegIterationOp                 RegEntryIterationOp
  107.  
  108.  
  109.                                                             ; Absolute locations
  110. kRegIterRoot                    EQU        $00000002            ; "Upward" Relationships    
  111. kRegIterParents                    EQU        $00000003            ; include all  parent(s) of entry 
  112.                                                             ; "Downward" Relationships
  113. kRegIterChildren                EQU        $00000004            ; include all children 
  114. kRegIterSubTrees                EQU        $00000005            ; include all sub trees of entry 
  115. kRegIterDescendants                EQU        $00000005            ; include all descendants of entry 
  116.                                                             ; "Horizontal" Relationships    
  117. kRegIterSibling                    EQU        $00000006            ; include all siblings 
  118.                                                             ; Keep doing the same thing
  119. kRegIterContinue                EQU        $00000001
  120. ; *******************************************************************************
  121. ; *
  122. ; * Name Entry and Property Modifiers
  123. ; *
  124. ; *
  125. ; *
  126. ; * Modifiers describe special characteristics of names
  127. ; * and properties.  Modifiers might be supported for
  128. ; * some names and not others.
  129. ; * 
  130. ; * Device Drivers should not rely on functionality
  131. ; * specified as a modifier.
  132.  
  133. ; typedef UInt32                         RegModifiers
  134.  
  135. ; typedef RegModifiers                     RegEntryModifiers
  136.  
  137. ; typedef RegModifiers                     RegPropertyModifiers
  138.  
  139.  
  140. kRegNoModifiers                    EQU        $00000000            ; no entry modifiers in place 
  141. kRegUniversalModifierMask        EQU        $0000FFFF            ; mods to all entries 
  142. kRegNameSpaceModifierMask        EQU        $00FF0000            ; mods to all entries within namespace 
  143. kRegModifierMask                EQU        $FF000000            ; mods to just this entry 
  144. ;  Universal Property Modifiers 
  145.  
  146. kRegPropertyValueIsSavedToNVRAM    EQU        $00000020            ; property is non-volatile (saved in NVRAM) 
  147. kRegPropertyValueIsSavedToDisk    EQU        $00000040            ; property is non-volatile (saved on disk) 
  148. ;  ///////////////////////
  149. ;//
  150. ;// The Registry API
  151. ;//
  152. ;/////////////////////// 
  153.  
  154. ;  ///////////////////////
  155. ;//
  156. ;// Entry Management
  157. ;//
  158. ;/////////////////////// 
  159.  
  160.  
  161. ; -------------------------------
  162. ; * EntryID handling
  163.  
  164. ; * Initialize an EntryID to a known invalid state
  165. ; *   note: invalid != uninitialized
  166.  
  167. ;
  168. ; extern OSStatus RegistryEntryIDInit(RegEntryID *id)
  169. ;
  170.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  171.         IMPORT_CFM_FUNCTION RegistryEntryIDInit
  172.     ENDIF
  173.  
  174. ; * Compare EntryID's for equality or if invalid
  175. ; *
  176. ; * If a NULL value is given for either id1 or id2, the other id 
  177. ; * is compared with an invalid ID.  If both are NULL, the id's 
  178. ; * are consided equal (result = true). 
  179.  
  180. ;
  181. ; extern Boolean RegistryEntryIDCompare(const RegEntryID *id1, const RegEntryID *id2)
  182. ;
  183.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  184.         IMPORT_CFM_FUNCTION RegistryEntryIDCompare
  185.     ENDIF
  186.  
  187. ; * Copy an EntryID
  188.  
  189. ;
  190. ; extern OSStatus RegistryEntryIDCopy(const RegEntryID *src, RegEntryID *dst)
  191. ;
  192.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  193.         IMPORT_CFM_FUNCTION RegistryEntryIDCopy
  194.     ENDIF
  195.  
  196. ; * Free an ID so it can be reused.
  197.  
  198. ;
  199. ; extern OSStatus RegistryEntryIDDispose(RegEntryID *id)
  200. ;
  201.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  202.         IMPORT_CFM_FUNCTION RegistryEntryIDDispose
  203.     ENDIF
  204.  
  205. ; -------------------------------
  206. ; * Adding and removing entries
  207. ; *
  208. ; * If (parentEntry) is NULL, the name is assumed
  209. ; * to be a rooted path. It is rooted to an anonymous, unnamed root.
  210.  
  211. ;
  212. ; extern OSStatus RegistryCStrEntryCreate(const RegEntryID *parentEntry, const RegCStrPathName *name, RegEntryID *newEntry)
  213. ;
  214.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  215.         IMPORT_CFM_FUNCTION RegistryCStrEntryCreate
  216.     ENDIF
  217.  
  218. ;
  219. ; extern OSStatus RegistryEntryDelete(const RegEntryID *id)
  220. ;
  221.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  222.         IMPORT_CFM_FUNCTION RegistryEntryDelete
  223.     ENDIF
  224.  
  225. ;
  226. ; extern OSStatus RegistryEntryCopy(RegEntryID *parentEntryID, RegEntryID *sourceDevice, RegEntryID *destDevice)
  227. ;
  228.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  229.         IMPORT_CFM_FUNCTION RegistryEntryCopy
  230.     ENDIF
  231.  
  232. ; ---------------------------
  233. ; * Traversing the namespace
  234. ; *
  235. ; * To support arbitrary namespace implementations in the future,
  236. ; * I have hidden the form that the place pointer takes.  The previous
  237. ; * interface exposed the place pointer by specifying it as a
  238. ; * RegEntryID.
  239. ; *
  240. ; * I have also removed any notion of returning the entries
  241. ; * in a particular order, because an implementation might
  242. ; * return the names in semi-random order.  Many name service
  243. ; * implementations will store the names in a hashed lookup
  244. ; * table.
  245. ; *
  246. ; * Writing code to traverse some set of names consists of
  247. ; * a call to begin the iteration, the iteration loop, and
  248. ; * a call to end the iteration.  The begin call initializes
  249. ; * the iteration cookie data structure.  The call to end the 
  250. ; * iteration should be called even in the case of error so 
  251. ; * that allocated data structures can be freed.
  252. ; *
  253. ; *    Create(...)
  254. ; *    do {
  255. ; *        Iterate(...);
  256. ; *    } while (!done);
  257. ; *    Dispose(...);
  258. ; *
  259. ; * This is the basic code structure for callers of the iteration
  260. ; * interface.
  261.  
  262.  
  263.  
  264. ;  
  265. ; * create/dispose the iterator structure
  266. ; *   defaults to root with relationship = kRegIterDescendants
  267.  
  268. ;
  269. ; extern OSStatus RegistryEntryIterateCreate(RegEntryIter *cookie)
  270. ;
  271.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  272.         IMPORT_CFM_FUNCTION RegistryEntryIterateCreate
  273.     ENDIF
  274.  
  275. ;
  276. ; extern OSStatus RegistryEntryIterateDispose(RegEntryIter *cookie)
  277. ;
  278.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  279.         IMPORT_CFM_FUNCTION RegistryEntryIterateDispose
  280.     ENDIF
  281.  
  282. ;  
  283. ; * set Entry Iterator to specified entry
  284.  
  285. ;
  286. ; extern OSStatus RegistryEntryIterateSet(RegEntryIter *cookie, const RegEntryID *startEntryID)
  287. ;
  288.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  289.         IMPORT_CFM_FUNCTION RegistryEntryIterateSet
  290.     ENDIF
  291.  
  292. ; * Return each value of the iteration
  293. ; *
  294. ; * return entries related to the current entry
  295. ; * with the specified relationship
  296.  
  297. ;
  298. ; extern OSStatus RegistryEntryIterate(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done)
  299. ;
  300.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  301.         IMPORT_CFM_FUNCTION RegistryEntryIterate
  302.     ENDIF
  303.  
  304. ; * return entries with the specified property
  305. ; *
  306. ; * A NULL RegPropertyValue pointer will return an
  307. ; * entry with the property containing any value.
  308.  
  309. ;
  310. ; extern OSStatus RegistryEntrySearch(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  311. ;
  312.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  313.         IMPORT_CFM_FUNCTION RegistryEntrySearch
  314.     ENDIF
  315.  
  316. ; --------------------------------
  317. ; * Find a name in the namespace
  318. ; *
  319. ; * This is the fast lookup mechanism.
  320. ; * NOTE:  A reverse lookup mechanism
  321. ; *      has not been provided because
  322. ; *        some name services may not
  323. ; *        provide a fast, general reverse
  324. ; *        lookup.
  325.  
  326. ;
  327. ; extern OSStatus RegistryCStrEntryLookup(const RegEntryID *searchPointID, const RegCStrPathName *pathName, RegEntryID *foundEntry)
  328. ;
  329.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  330.         IMPORT_CFM_FUNCTION RegistryCStrEntryLookup
  331.     ENDIF
  332.  
  333. ; ---------------------------------------------
  334. ; * Convert an entry to a rooted name string
  335. ; *
  336. ; * A utility routine to turn an Entry ID
  337. ; * back into a name string.
  338.  
  339. ;
  340. ; extern OSStatus RegistryEntryToPathSize(const RegEntryID *entryID, RegPathNameSize *pathSize)
  341. ;
  342.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  343.         IMPORT_CFM_FUNCTION RegistryEntryToPathSize
  344.     ENDIF
  345.  
  346. ;
  347. ; extern OSStatus RegistryCStrEntryToPath(const RegEntryID *entryID, RegCStrPathName *pathName, RegPathNameSize pathSize)
  348. ;
  349.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  350.         IMPORT_CFM_FUNCTION RegistryCStrEntryToPath
  351.     ENDIF
  352.  
  353. ; * Parse a path name.
  354. ; *
  355. ; * Retrieve the last component of the path, and
  356. ; * return a spec for the parent.
  357.  
  358. ;
  359. ; extern OSStatus RegistryCStrEntryToName(const RegEntryID *entryID, RegEntryID *parentEntry, RegCStrEntryName *nameComponent, Boolean *done)
  360. ;
  361.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  362.         IMPORT_CFM_FUNCTION RegistryCStrEntryToName
  363.     ENDIF
  364.  
  365. ;  //////////////////////////////////////////////////////
  366. ;//
  367. ;// Property Management
  368. ;//
  369. ;////////////////////////////////////////////////////// 
  370.  
  371. ; -------------------------------
  372. ; * Adding and removing properties
  373.  
  374. ;
  375. ; extern OSStatus RegistryPropertyCreate(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  376. ;
  377.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  378.         IMPORT_CFM_FUNCTION RegistryPropertyCreate
  379.     ENDIF
  380.  
  381. ;
  382. ; extern OSStatus RegistryPropertyDelete(const RegEntryID *entryID, const RegPropertyName *propertyName)
  383. ;
  384.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  385.         IMPORT_CFM_FUNCTION RegistryPropertyDelete
  386.     ENDIF
  387.  
  388. ;
  389. ; extern OSStatus RegistryPropertyRename(const RegEntryID *entry, const RegPropertyName *oldName, const RegPropertyName *newName)
  390. ;
  391.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  392.         IMPORT_CFM_FUNCTION RegistryPropertyRename
  393.     ENDIF
  394.  
  395. ; ---------------------------
  396. ; * Traversing the Properties of a name
  397. ; *
  398.  
  399.  
  400.  
  401. ;
  402. ; extern OSStatus RegistryPropertyIterateCreate(const RegEntryID *entry, RegPropertyIter *cookie)
  403. ;
  404.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  405.         IMPORT_CFM_FUNCTION RegistryPropertyIterateCreate
  406.     ENDIF
  407.  
  408. ;
  409. ; extern OSStatus RegistryPropertyIterateDispose(RegPropertyIter *cookie)
  410. ;
  411.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  412.         IMPORT_CFM_FUNCTION RegistryPropertyIterateDispose
  413.     ENDIF
  414.  
  415. ;
  416. ; extern OSStatus RegistryPropertyIterate(RegPropertyIter *cookie, RegPropertyName *foundProperty, Boolean *done)
  417. ;
  418.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  419.         IMPORT_CFM_FUNCTION RegistryPropertyIterate
  420.     ENDIF
  421.  
  422. ; * Get the value of the specified property for the specified entry.
  423. ; *
  424.  
  425. ;
  426. ; extern OSStatus RegistryPropertyGetSize(const RegEntryID *entryID, const RegPropertyName *propertyName, RegPropertyValueSize *propertySize)
  427. ;
  428.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  429.         IMPORT_CFM_FUNCTION RegistryPropertyGetSize
  430.     ENDIF
  431.  
  432. ; * (*propertySize) is the maximum size of the value returned in the buffer
  433. ; * pointed to by (propertyValue).  Upon return, (*propertySize) is the size of the
  434. ; * value returned.
  435.  
  436. ;
  437. ; extern OSStatus RegistryPropertyGet(const RegEntryID *entryID, const RegPropertyName *propertyName, void *propertyValue, RegPropertyValueSize *propertySize)
  438. ;
  439.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  440.         IMPORT_CFM_FUNCTION RegistryPropertyGet
  441.     ENDIF
  442.  
  443. ;
  444. ; extern OSStatus RegistryPropertySet(const RegEntryID *entryID, const RegPropertyName *propertyName, const void *propertyValue, RegPropertyValueSize propertySize)
  445. ;
  446.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  447.         IMPORT_CFM_FUNCTION RegistryPropertySet
  448.     ENDIF
  449.  
  450. ;  //////////////////////////////////////////////////////
  451. ;//
  452. ;// Modifier Management
  453. ;//
  454. ;////////////////////////////////////////////////////// 
  455.  
  456. ; * Modifiers describe special characteristics of names
  457. ; * and properties.  Modifiers might be supported for
  458. ; * some names and not others.
  459. ; * 
  460. ; * Device Drivers should not rely on functionality
  461. ; * specified as a modifier.  These interfaces
  462. ; * are for use in writing Experts.
  463.  
  464. ; * Get and Set operators for entry modifiers
  465.  
  466. ;
  467. ; extern OSStatus RegistryEntryGetMod(const RegEntryID *entry, RegEntryModifiers *modifiers)
  468. ;
  469.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  470.         IMPORT_CFM_FUNCTION RegistryEntryGetMod
  471.     ENDIF
  472.  
  473. ;
  474. ; extern OSStatus RegistryEntrySetMod(const RegEntryID *entry, RegEntryModifiers modifiers)
  475. ;
  476.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  477.         IMPORT_CFM_FUNCTION RegistryEntrySetMod
  478.     ENDIF
  479.  
  480. ; * Get and Set operators for property modifiers
  481.  
  482. ;
  483. ; extern OSStatus RegistryPropertyGetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers *modifiers)
  484. ;
  485.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  486.         IMPORT_CFM_FUNCTION RegistryPropertyGetMod
  487.     ENDIF
  488.  
  489. ;
  490. ; extern OSStatus RegistryPropertySetMod(const RegEntryID *entry, const RegPropertyName *name, RegPropertyModifiers modifiers)
  491. ;
  492.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  493.         IMPORT_CFM_FUNCTION RegistryPropertySetMod
  494.     ENDIF
  495.  
  496. ; * Iterator operator for entry modifier search
  497.  
  498. ;
  499. ; extern OSStatus RegistryEntryMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegEntryModifiers matchingModifiers)
  500. ;
  501.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  502.         IMPORT_CFM_FUNCTION RegistryEntryMod
  503.     ENDIF
  504.  
  505. ; * Iterator operator for entries with matching 
  506. ; * property modifiers
  507.  
  508. ;
  509. ; extern OSStatus RegistryEntryPropertyMod(RegEntryIter *cookie, RegEntryIterationOp relationship, RegEntryID *foundEntry, Boolean *done, RegPropertyModifiers matchingModifiers)
  510. ;
  511.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  512.         IMPORT_CFM_FUNCTION RegistryEntryPropertyMod
  513.     ENDIF
  514.  
  515.  
  516.     ENDIF ; __NAMEREGISTRY__ 
  517.  
  518.